package cn.daniellee.plugin.ce.storage;

import cn.daniellee.plugin.ce.CraftEconomy;
import cn.daniellee.plugin.ce.model.PlayerData;

public class StorageConverter {

	private MysqlStorage mysqlStorage;

	private YamlStorage yamlStorage;

	public StorageConverter(MysqlStorage mysqlStorage, YamlStorage yamlStorage) {
		this.mysqlStorage = mysqlStorage;
		this.yamlStorage = yamlStorage;
	}

	public void execute() {
		for (PlayerData playerData : yamlStorage.getAllPlayerData()) {
			mysqlStorage.insertPlayerData(CraftEconomy.getInstance().isOnlineMode() ? playerData.getUuid() : playerData.getName(), playerData.getBalance());
		}
	}
}
